//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#ifndef _ListBindingSitePrediction_h__
#define _ListBindingSitePrediction_h__
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include "ProcessCathFASTAProfile.h"
#include "Pratt2PatternsByCATH.h"
#include "ProcessBindingFASTAProfile.h"
#include "SearchPrositePattern.h"
#include "PredictBindingSiteByPattern.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#define SCORE_NORMAL         0
#define SCORE_CUMULATIVE     1
#define SCORE_BINARY         2
#define SCORE_NORMALIZED     3

#define PATTERN_COMPACT      0
#define PATTERN_EXTENDED     1
#define TYPE_PATTERN_COUNT   PATTERN_COMPACT 

#define BY_SUM               0
#define BY_PRODUCT           1
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
namespace BindingSitePrediction {

  bool EqualHeader (TNode <PredictBindingSiteByPattern>* predictBindingSiteByPattern, void* ref);
  bool EqualHeaderBSAndPrediction (TNode <BindingInfo>* bindingInfo, void* ref);
  
}  
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
class ListBindingSitePrediction { 

  private:
    
    String                                OutFormatedArray (String* data, int type);
    String                                OutFormatedArray (float* data, int size, int type);

  protected:

    String*                               filenameCATH;
    String*                               filenamePatterns;
    String*                               filenameAnchorResidues;
    String*                               filenameOut;

    ProcessCathFASTAProfile*              fastaProfile;
    Pratt2PatternsByCATH*                 listPatterns;
    ProcessBindingFASTAProfile*           bindingProfile;

    TListE <PredictBindingSiteByPattern>* predictionsBS;

    String*                               toString;

public:

    ListBindingSitePrediction ();
    ListBindingSitePrediction (const ListBindingSitePrediction&);
    ListBindingSitePrediction (const ListBindingSitePrediction*);

    ~ListBindingSitePrediction ();

    void                                  FilenameCATH (String* filenameCATH);
    void                                  FilenamePatterns (String* filenamePatterns);
    void                                  FilenameAnchorResidues (String* filenameAnchorResidues);
    void                                  FilenameOut (String* filenameOut);
    void                                  FastaProfile (ProcessCathFASTAProfile* fastaProfile);
    void                                  ListPatterns (Pratt2PatternsByCATH* listPatterns);
    void                                  BindingProfile (ProcessBindingFASTAProfile* bindingProfile);
    void                                  PredictionsBS (TListE <PredictBindingSiteByPattern>* predictionsBS);

    String*                               FilenameCATH (void);
    String*                               FilenamePatterns (void);
    String*                               FilenameAnchorResidues (void);
    String*                               FilenameOut (void);
    ProcessCathFASTAProfile*              FastaProfile (void);
    Pratt2PatternsByCATH*                 ListPatterns (void);
    ProcessBindingFASTAProfile*           BindingProfile (void);
    TListE <PredictBindingSiteByPattern>* PredictionsBS (void);

    bool                                  LoadData (void);

    bool                                  PredictBindingSiteByType (String* type, float presicion, int scoreType);
    bool                                  PredictBindingSite (String* namefileAA, float presicionAA, 
                                                              String* namefileCH, float presicionCH, 
                                                              String* namefilePH, float presicionPH, 
                                                              String* namefileSS, float presicionSS, 
                                                              String* namefileMT, float presicionMT, 
                                                              int scoreType);
    
    bool                                  PredictBindingSiteByTypeLengthWeighted (String* type, float presicion, int scoreType);
    bool                                  PredictBindingSiteLengthWeighted (String* namefileAA, float presicionAA, 
                                                                            String* namefileCH, float presicionCH, 
                                                                            String* namefilePH, float presicionPH, 
                                                                            String* namefileSS, float presicionSS, 
                                                                            String* namefileMT, float presicionMT, 
                                                                            int scoreType);
    
    bool                                  FillCumulativePredictionBindingSite (float presicionAA, float presicionCH, float presicionPH, float presicionSS, float presicionMT, int scoreType, int considered, int type);
    
    bool                                  FillAnchorPositions (void);

    String*                               ToStringScores (void);
    String*                               ToCSVScores (void);
    
    bool                                  OutToFile (void);
    bool                                  OutToCSVFile (void);

    ListBindingSitePrediction             operator= (const ListBindingSitePrediction& listBindingSitePrediction);

};
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#endif
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
